/*
 *  Lightcycle.cpp
 *  EidoTron
 *
 *  Created by Luca Di Franco on 06/05/11.
 *  Copyright 2011 Luca Di Franco. All rights reserved.
 *
 */

#include "Lightcycle.h"

#include <algorithm>

#include "Material.h"

using std::min;
using std::max;

Lightcycle::Lightcycle(float* color) : BOEntity("lightcycle.obj")
{
	for (vector< Material* >::iterator iter = materials.begin(); iter != materials.end(); iter++)
		(*iter)->mulColor(color);
}

Lightcycle::~Lightcycle()
{ }

void Lightcycle::accelerate(float seconds)
{
	currentSpeed = min(currentSpeed + acceleration * seconds, maxSpeed);
}

void Lightcycle::decelerate(float seconds)
{
	currentSpeed = max(currentSpeed - acceleration * seconds, minSpeed);
}

float Lightcycle::getCurrentSpeed()
{
	return currentSpeed;
}

float Lightcycle::getAgility()
{
	return agility;
}